/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package medialibrary.persistence;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

/**
 *
 * @author user
 */
@Entity
@Table(name = "administrator")

public class Administrator implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @NotNull
    @Column(name = "administratorId")
    private Integer administratorId;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 7)
    @Column(name = "login")
    private String login;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 12)
    @Column(name = "password")
    private String password;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "administratorId")
    private Collection<Borrowing> borrowingCollection;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "administratorId")
    private Collection<Ordre> order1Collection;

    public Administrator() {
    }

    public Administrator(Integer administratorId) {
        this.administratorId = administratorId;
    }

    public Administrator(Integer administratorId, String login, String password) {
        this.administratorId = administratorId;
        this.login = login;
        this.password = password;
    }

    public Integer getAdministratorId() {
        return administratorId;
    }

    public void setAdministratorId(Integer administratorId) {
        this.administratorId = administratorId;
    }

    public String getLogin() {
        return login;
    }

    public void setLogin(String login) {
        this.login = login;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public Collection<Borrowing> getBorrowingCollection() {
        return borrowingCollection;
    }

    public void setBorrowingCollection(Collection<Borrowing> borrowingCollection) {
        this.borrowingCollection = borrowingCollection;
    }

    public Collection<Ordre> getOrder1Collection() {
        return order1Collection;
    }

    public void setOrder1Collection(Collection<Ordre> order1Collection) {
        this.order1Collection = order1Collection;
    }
   
    public String toString() {
        return administratorId+"";
    }
    
}
